package kiven.jee.pagination;

import java.util.Collections;
import java.util.List;

/**
 * 表示分页中的一页
 * 
 * @author kiven
 * @date 2013-03-01
 * 
 */
@SuppressWarnings("unchecked")
public class Page<E> {
	// 是否是首页
	private boolean hasPre;
	// 是否是尾页
	private boolean hasNext;
	// 当前页包含记录列表
	private List<E> items;
	// 当前页页面(起始为1)
	private int index;
	private IPageContext<E> context;

	public boolean isHasPre() {
		return hasPre;
	}

	public void setHasPre(boolean hasPre) {
		this.hasPre = hasPre;
	}

	public boolean isHasNext() {
		return hasNext;
	}

	public void setHasNext(boolean hasNext) {
		this.hasNext = hasNext;
	}

	public List<E> getItems() {
		return (items == null ? Collections.EMPTY_LIST : items);
	}

	public void setItems(List<E> items) {
		this.items = items;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public IPageContext<E> getContext() {
		return context;
	}

	public void setContext(IPageContext<E> context) {
		this.context = context;
	}

}
